package com.umanji.building.service;

import java.util.List;

import com.umanji.building.domain.PublicOfficialBuildingBoards;
import com.umanji.building.domain.PublicOfficialBuildings;

import org.springframework.security.access.prepost.PostFilter;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.security.access.prepost.PreFilter;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

@PreAuthorize("hasRole('ROLE_USER') or hasRole('ROLE_ADMIN')")
public interface PublicOfficialBuildingBoardService {

    @PostFilter("filterObject.email == principal.username or hasRole('ROLE_ADMIN')")
    @Transactional(value = "umanji", readOnly = true)
    List<PublicOfficialBuildingBoards> findAll();

    @Transactional(value = "umanji", readOnly = true)
    List<PublicOfficialBuildingBoards> findInRange(int firstResult, int maxResults);

    @Transactional(value = "umanji", readOnly = true)
    long count();

    @PreAuthorize("hasRole('ROLE_ADMIN')")
    @Transactional(value = "umanji", readOnly = false)
    void persist(PublicOfficialBuildingBoards entity);

    @PreFilter("filterObject.email == principal.username")
    @Transactional(value = "umanji", readOnly = false)
    void merge(PublicOfficialBuildingBoards entity);

    @PreAuthorize("hasRole('ROLE_ADMIN')")
    @Transactional(value = "umanji", readOnly = false)
    void remove(PublicOfficialBuildingBoards entity);

    @Transactional(value = "umanji", readOnly = true)
    PublicOfficialBuildingBoards find(Long id);

    @Transactional(value = "umanji", readOnly = true)
	List findByBoardId(Long boardId, int firstResult, int maxResults);

    @Transactional(value = "umanji", readOnly = false)
	void getBoardReadCount(Long boardId);

}
